<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="x-ua-compatible" content="IE=edge" charset="utf-8">
    <title>Login Servlet</title>
</head>

<body>
<h2>Login Servlet!</h2>
<form action="/login" method="post">
    <div>
        <input type="text" name="username">
        <input type="password" name="password">
        <div id="myid" class="nc-container"></div>
        <input id="sessionid" type="hidden" name="sessionid">
        <input id="sig" type="hidden" name="sig">
        <input id="token" type="hidden" name="token">
        <input id="scene" type="hidden" name="scene" value="nc_login">
        <input type="submit" name="登录">
    </div>
</form>

<script type="text/javascript" charset="utf-8" src="//g.alicdn.com/sd/ncpc/nc.js?t=2018082815"></script>
<script type="text/javascript">
    var nc_token = ["FFFF0N000000000069E6", (new Date()).getTime(), Math.random()].join(':');
    var NC_Opt =
        {
            renderTo: "#myid",
            appkey: "FFFF0N000000000069E6",
            scene: "",
            token: nc_token,
            customWidth: 300,
            trans:{"key1":"code0"},
            elementID: ["usernameID"],
            isEnabled: true,
            times:3,
            callback: function (data) {
                document.getElementById("sessionid").value = data.csessionid;
                document.getElementById("sig").value = data.sig;
                document.getElementById("token").value = nc_token;
                //window.console && console.log(nc_token)
                //window.console && console.log(data.csessionid)
                //window.console && console.log(data.sig)
            }
        }
    var nc = new noCaptcha(NC_Opt)
    nc.upLang('cn', {
        _startTEXT: "请按住滑块，拖动到最右边",
        _yesTEXT: "验证通过",
        _error300: "哎呀，出错了，点击<a href=\"javascript:__nc.reset()\">刷新</a>再来一次",
        _errorNetwork: "网络不给力，请<a href=\"javascript:__nc.reset()\">点击刷新</a>",
    })
</script>
</body>
</html>